1. Field of the Invention
The present invention relates to a data transfer apparatus which performs DMA (Direct Memory Access) transfer using chained lists, a data transfer method, and a storage medium.
2. Description of the Related Art
Since using a CPU to perform data transfer with a memory or a peripheral puts a heavy load on the CPU, it is a common practice to perform such data transfer using DMA. In the DMA transfer, in order to insert data at another address in the middle of continuous data to be transferred and then transfer the obtained data, it is necessary to transfer data before the insertion point, transfer data to be inserted, and then transfer data after the insertion point. For this purpose, the intervention of a main control unit such as a CPU is required to perform the series of data transfer operations. To solve this problem, Japanese Patent Laid-Open No. 2001-167046 proposes DMA in which only DMA processing is executed to insert data and transfer the obtained data without the intervention of a CPU by setting an insertion position and the like in advance.
There is also well known a DMA apparatus with a scatter/gather function in which when data to be transferred are discontinuously arranged, a chained list for a transfer operation is created in advance and a transfer operation is performed based on the created chained list.
On the other hand, in recent years, not only a general-purpose PC but also a built-in device has been required to execute various processes at high speed. However, the capacity of the processor of the built-in device is not enough to achieve the required performance only by processing by software in the main CPU. As a method of improving the processing performance by adding an auxiliary device, it is a common practice to implement some functions of a system as a sub-system. As described above, in a processing system which executes processing by offloading it from the main CPU to the sub-system, the main CPU generally executes the pre-processing and post-processing of the processing in the sub-system.
With respect to a chained list of transfer source data, a transfer destination buffer, and the like, which has been created in the main memory by the main CPU, the sub-system may perform scatter/gather transfer according to the chained list. In this case, as a result of the processing on the sub-system side, it may be necessary to insert data in the middle of data to be transferred. The method disclosed in Japanese Patent Laid-Open No. 2001-167046 is used for a DMA apparatus which inserts data in the middle of continuous data, and therefore has no effect when it is required to insert data in the middle of data which are discontinuously arranged and are formed by a chained list. That is, as in the conventional technique, it is necessary to perform a DMA transfer operation using a chained list several times, or to perform a DMA transfer operation by modifying a chained list. Since, however, the chained list needs to be arranged in a continuous area, and is arranged in a memory area managed by the main CPU, it is impossible to add or modify the chained list. It is, therefore, necessary to perform a DMA transfer operation by copying, to a memory area managed by the sub-system, the chained list created by the main CPU, and adding or modifying the chained list.
As a result of the processing in the sub-system for data acquired by itself from a device or the like, the sub-system may delete some data, and then pass the remaining data to the main CPU. In this case, it is necessary to modify the chained list used when the data is acquired from the device and then perform a transfer operation to a transfer destination buffer prepared by the main CPU, or to make a copy of the data itself to comply with the chained list, and then perform a transfer operation.
That is, it is impossible to use the created chained list intact when inserting or deleting part of data formed by the chained list. It is, therefore, necessary to re-create a chained list, or to make a copy of the data itself to comply with the chained list and arrange the obtained data. These operations are inefficient, and put a heavy load on the CPU.